package com.lwj.liwanjia.model;

import com.lwj.liwanjia.api.ApiService;
import com.lwj.liwanjia.bean.fabu.FabuTypeBean;
import com.lwj.liwanjia.utils.RetrofitHelper;

import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

/**
 * Created by Administrator on 2018/1/13.
 */

public class FabuTypeModel {
    public void getTypeData(String token, int id, Subscriber<FabuTypeBean> subscriber) {
        if (id == -1) {
            RetrofitHelper.getSingleRetrofit()
                    .create(ApiService.class)
                    .getTypeData(token)
                    .subscribeOn(Schedulers.io())
                    .observeOn(AndroidSchedulers.mainThread())
                    .subscribe(subscriber);
        } else {
            RetrofitHelper.getSingleRetrofit()
                    .create(ApiService.class)
                    .getTypeData1(token, id)
                    .subscribeOn(Schedulers.io())
                    .observeOn(AndroidSchedulers.mainThread())
                    .subscribe(subscriber);
        }
    }
}
